/**
File Name 	: Time.h
Name, NIM	: Muqtafi Akhmad, 23512021
 **/
#ifndef TIME_H
#define	TIME_H

#include "..\Utilities\boolean.h"

// Type Time : < H: integer [0..23]; { hour part } 
// M : integer [0..59; { Minutes part} 
// S : integer [0..59] > {Second part} 

typedef struct {
    int H;
    int M;
    int S;
} Time;

// { Getter and Setter } 
// function GetHour (T:Time) -> integer [0..23]; {Return Hour part of T} 
int GetHour(Time T);
// function GetMin (T:Time) -> integer [0..59]; { Return Minutes part of T } 
int GetMin(Time T);
// function GetSec (T:Time) -> integer [0..59]; { Return Second part of T } 
int GetSec(Time T);
// procedure SetHour (input/output T:Time); 
void SetHour(Time *T, int H);
// procedure SetMin (input /output T:Time); 
void SetMin(Time *T, int M);
// procedure SetSec (input /output T:Time); 
void SetSec(Time *T, int S);

// {Time Composition }
// boolean IsValidTime (H,M,S);
// {H,M,S are valid value for composing a Time }
boolean IsValidTime(int H, int M, int S);
// function MakeTime (H,M,S : integer) -> Time
// { precondition : isvalidTime (H,M,S) }
// { return a Time from H,M,S }
Time MakeTime(int H, int M, int S);
// boolean EqTime (T1, T2:Time);
// {Return true if T1== T2, i.e T1 and T2 have the same H,M and S }
// {in C language, false ==0 }
boolean EqTime(Time T1, Time T2);
// function NextSec (T:Time} -> Time
// {return 1 second after T }
Time NextSec(Time T);
// function BeforeSec (T:Time} -> Time
// {return 1 second before T } 
Time BeforeSec(Time T);
// function TimeLessThan(T1, T2 : Time) -> boolean
// returns true if T1 < T2
boolean TimeLessThan(Time T1, Time T2);
// function AddTime (T1,T2: Time}-> Time 
// {return T1 + T2 } 
Time AddTime(Time T1, Time T2);
// procedure AccTime (input/OutputT1:Time, input T2: Time} 
// {I.S. T1 is defined } 
// {F.S. T1 = T1 + T2 }
void AccTime(Time *T1, Time T2);
// function TimeToSecond(Time T) -> long int
// converts a time to seconds
long int TimeToSecond(Time T);
// function ToTime(long int second) -> Time
// converts second in long integer to time
Time ToTime(long int second);
#endif

